package com.zoo.boot.controller;

import com.zoo.boot.dto.MenuIndexDto;
import com.zoo.boot.service.MenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 主页管理
 *
 * @Author: WangB
 * @Date: 2021/6/23
 */
@Controller
@Api(tags = "AdminMasterController", value = "主页管理")
@RequestMapping("/api")
public class AdminMasterController {

    @Autowired
    private MenuService menuService;

    /**
     * 展示首頁
     *
     * @return
     */
    @ApiOperation("展示首页")
    @GetMapping
    public String index() {
        return "index";
    }


    /**
     * 展示左边菜单树
     *
     * @return
     */
    @ApiOperation("首页获取左边菜单树")
    @GetMapping("/menus")
    @ResponseBody
    public List<MenuIndexDto> menus() {
        return menuService.menus();
    }

    /**
     * 获取首页右边展示页面
     *
     * @return
     */
    @GetMapping("/console")
    @ApiOperation("首页右边展示页面")
    public String console() {
        return "console/console1";
    }


    @GetMapping("/403.html")
    @ApiOperation("展示403页面")
    public String  error403(){
        return "error/403.html";
    }
}
